<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>AdminLTE 2 | Log in</title><!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"><!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="/css/bootstrap/bootstrap.min.css">

    <link rel="stylesheet" href="/css/AdminLTE.min.css">

    <script src="js/plugins/jQuery/jquery-2.2.3.min.js"></script><!-- Bootstrap 3.3.6 -->
    <script src="/js/bootstrap/bootstrap.min.js"></script>
    <script src="/js/model/login/login.js"></script>
</head>
<body class="hold-transition login-page" style="background:url(/images/background_new.jpg) top left;
    background-size:100% 100%;
    overflow:hidden; margin:10px;">
<div class="login-box">

    <!-- /.login-logo -->
    <div class="login-box-body">
        <p class="login-box-msg">登录系统</p>

        <div>
            <div class="form-group has-feedback">
                <input id="userName" type="email" class="form-control" placeholder="Email">
                <span class="glyphicon glyphicon-envelope form-control-feedback"></span>
            </div>
            <div class="form-group has-feedback">
                <input id="password" type="password" class="form-control" placeholder="Password">
                <span class="glyphicon glyphicon-lock form-control-feedback"></span>
            </div>
            <div class="row">
                <!--<div class="col-xs-8">-->
                    <!--<div class="checkbox icheck">-->
                        <!--<label>-->
                            <!--<input type="checkbox"> Remember Me-->
                        <!--</label>-->
                    <!--</div>-->
                <!--</div>-->
                <!-- /.col -->
                <div class="col-xs-4">
                    <button id="login" >登录</button>
                </div>
                <!-- /.col -->
            </div>
        </div>



    </div>
    <!-- /.login-box-body -->
</div>
<!-- /.login-box -->



<script>


    $(document).ready(function () {

        $("#login").click(
            function () {
              var params = {};
              params.userName = $("#userName").val();
              params.password = $("#password").val();
              $.ajax({
                type: 'POST',
                url: "/user/login",
                data: params,
                success: function (result) {
                    if(result=='success'){
                      window.location.href = "/starter.html";
                    }
                    else {
                        if(result=='fail')
                            alert("用户名/密码错误");
                        else {
                            alert("登录异常，请稍后重试。");
                        }
                    }
                },
                dataType: "text"
              });
            }
        );

    });
</script>
</body>
</html>
